﻿@model FieldControlViewModel
@{ 
	string dataVal = " data-val-regex-pattern=\"" + RegexHelper.UrlPattern + "\" data-val-regex=\"url格式不对\"";
	string dataValMsg = string.Empty;
	if (Model.EnableNull)
	{
		dataVal += " data-val-required=\"不能为空\" ";
	}
	if (!string.IsNullOrEmpty(dataVal))
	{
		dataVal += " data-val=\"true\" ";
		dataValMsg = " data-valmsg-for=\""+ Model.Prefix + Model.FieldName + "\" data-valmsg-replace=\"true\"";
	}
}
<input type="text" class="layui-input" name="@Model.Prefix@Model.FieldName" id="@Model.Prefix@Model.FieldName" value="@Model.FieldValue" @Html.Raw(dataVal) />
<span class="layui-bg-green">@Model.Description</span>
<span style="color:red;" @Html.Raw(dataValMsg)></span>